/**********************************************************************************
// Color Source
// 
// Creation:	07 Oct 2007
// Updated:		28 Apr 2011
// Compiler:	Visual Studio 2010
//
// Notes:		A color is a 32-bit value with Alpha, Red, 
//              Green and Blue components.
//
**********************************************************************************/

#include "Color.h"

/**********************************************************************************/

Color::Color() : alpha(255), red(0), green(0), blue(0) {}

/**********************************************************************************/

Color::Color(uchar r, uchar g, uchar b) 
: alpha(255), red(r), green(g), blue(b) {}

/**********************************************************************************/

Color::Color(uchar a, uchar r, uchar g, uchar b)
: alpha(a), red(r), green(g), blue(b) {}

/**********************************************************************************/

Color& Color::operator=(const Color& c)
{
	alpha = c.alpha;
	red   = c.red;
	green = c.green;
	blue  = c.blue;

	return *this;
}

/**********************************************************************************/
// can subtract an int from a color

Color& Color::operator-(const int n)
{
	if ((red = red - n) < 0)
		red = 0;
	if ((green = green - n) < 0)
		green = 0;
	if ((blue  = blue - n) < 0)
		blue = 0;

	return *this;
}

/**********************************************************************************/